package com.example.goodsprovider.controller;

import com.example.goodsprovider.mapper.GoodsMapper;
import com.myshop.b2b.commonmodule.Goods;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author likaiping
 * @createTime 2024/7/3 15:32
 */
@RestController
@AllArgsConstructor
public class GoodsController {
    private GoodsMapper goodsMapper;

    @GetMapping("/getAllgoods")
    public List<Goods> getAllgoods(){
        return goodsMapper.getAllgoods();
    };

    //根据商品名字查询商品
    @GetMapping("/getOnegoods")
    public List<Goods> getOnegoods(@RequestParam(value = "gname")String gname){
        return goodsMapper.getOnegoods(gname);
    }

    //根据商品ID查询商品
    @GetMapping("/getOnegid")
    public Goods getOnegid(@RequestParam(value = "gid")int gid){
        return goodsMapper.getOnegid(gid);
    }
}
